package com.zhouyibike.uu.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.zhouyibike.uu.R;
import com.zhouyibike.uu.entity.CityBikeCompanyOrderListResult;

import java.util.List;

/**
 * Created by cc on 2017/5/3.
 */

public class MyhehuorendetailAdapter extends BaseAdapter {
    private Context context;
    private List<CityBikeCompanyOrderListResult.DataBean> list;

    public MyhehuorendetailAdapter(Context context, List<CityBikeCompanyOrderListResult.DataBean> list) {
        this.context = context;
        this.list = list;
    }
    public  void setList(List<CityBikeCompanyOrderListResult.DataBean> list){
        this.list = list;
        notifyDataSetChanged();
    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView= LayoutInflater.from(context).inflate(R.layout.item_hehuorendetail,null);
        TextView tv_type= (TextView) convertView.findViewById(R.id.tv_detail_caozuo);
        TextView tv_time= (TextView) convertView.findViewById(R.id.tv_mydetail_time);
        TextView tv_miney= (TextView) convertView.findViewById(R.id.tv_detail_money);
//        tv_mydetail_time
        tv_time.setText(list.get(position).getCreateTime());
        tv_miney.setText(list.get(position).getMoney()+"");
        if (list.get(position).getBuyType()!=null&&list.get(position).getBuyType().equals("认购单车"))
        {
            tv_type.setText(list.get(position).getBuyType()+":"+list.get(position).getNumber()+"辆");
        }else if (list.get(position).getBuyType()!=null&&list.get(position).getBuyType().equals("翼券消费")){
            tv_type.setText(list.get(position).getBuyType());
        }

        return convertView;
    }
}
